package org.stvd.repository.base;

import java.util.List;
import java.util.Map;

import org.stvd.core.dto.QueryResult;

public interface BaseDao<T> {

    T findByPk(Class<T> t, Object pk);

    List<T> findAll(Class<T> t);

    void insert(T entity);

    void update(T entity);

    void delete(Class<T> t, Object pk);
    
    long getCountByHQL(String hql, Object... params);
    
    long getCountByHQL(String hql, Map<String, Object> params);
    
    long getCountBySQL(String sql, Object... params);
    
    long getCountBySQL(String sql, Map<String, Object> params);

    List<T> findByHQL(String hql, Object... params);

    List<T> findByHQL(String hql, Map<String, Object> params);
    
    List<T> findByHQL(int start, int limit, String hql, Object... params);
    
    List<T> findByHQL(int start, int limit, String hql, Map<String, Object> params);

    List<Object[]> findBySQL(String sql, Object... params);

    List<Object[]> findBySQL(int start, int limit, String sql, Object... params);
    
    List<Map<String, Object>> findBySQLToMap(String sql, Map<String, Object> params);
    
    List<Map<String, Object>> findBySQLToMap(int start, int limit, String sql, Map<String, Object> params);

    QueryResult<T> getQueryResultByHQL(int start, int limit, String hql, Object... params);

    QueryResult<T> getQueryResultByHQL(int start, int limit, String hql, Map<String, Object> params);
    
    QueryResult<Object[]> getQueryResultBySQL(int start, int limit, String sql, Object... params);

    QueryResult<Map<String, Object>> getQueryResultBySQLToMap(int start, int limit, String sql, Map<String, Object> params);
    
    int execSQL(String sql);
    
    int execHQL(String hql);
}